import { ICatalog } from '@/types/keyobject'
import { defineStore } from 'pinia'
import { computed, ref } from 'vue'

export const useKeyObjectStore = defineStore('keyobject', () => {
    const curCatalog = ref<ICatalog>()

    const curCatalogName = computed(() => {
        return curCatalog.value?.name || null
    })
    const curCatalogId = computed(() => {
        return curCatalog.value?.id
    })

    const curSchema = ref<any[] | string>('')

    const treeData = ref()

    const rootCatalog = ref<ICatalog>()

    return {
        curCatalog,
        curCatalogName,
        treeData,
        curCatalogId,
        curSchema,
        rootCatalog,
    }
})
